<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>ActionView::Context</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/github.css" type="text/css" media="screen" />
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>

</head>

<body>     
    <div class="banner">
        
            <span>Ruby on Rails v4.0.0</span><br />
        
        <h1>
            <span class="type">Module</span> 
            ActionView::Context 
            
        </h1>
        <ul class="files">
            
            <li><a href="../../files/actionpack/lib/action_view/context_rb.html">actionpack/lib/action_view/context.rb</a></li>
            
        </ul>
    </div>
    <div id="bodyContent">
        <div id="content">
  
    <div class="description">
      
<h1 id="label-Action+View+Context">Action View <a href="Context.html">Context</a></h1>

<p>Action View contexts are supplied to Action Controller to render a
template. The default Action View context is <a
href="Base.html">ActionView::Base</a>.</p>

<p>In order to work with <a
href="../ActionController.html">ActionController</a>, a <a
href="Context.html">Context</a> must just include this module. The
initialization of the variables used by the context (@<a
href="Context.html#attribute-i-output_buffer">#output_buffer</a>, @<a
href="Context.html#attribute-i-view_flow">#view_flow</a>, and
@virtual_path) is responsibility of the object that includes this module
(although you can call <a
href="Context.html#method-i-_prepare_context">#_prepare_context</a> defined
below).</p>

    </div>
  


  


  
  


  


  
    <!-- Method ref -->
    <div class="sectiontitle">Methods</div>
    <dl class="methods">
      
        <dt>#</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Context.html#method-i-_layout_for">_layout_for</a>,
              </li>
            
              
              <li>
                <a href="Context.html#method-i-_prepare_context">_prepare_context</a>
              </li>
            
          </ul>
        </dd>
      
    </dl>
  

  



  

    

    

    


    
      <!-- Section attributes -->
      <div class="sectiontitle">Attributes</div>
      <table border='0' cellpadding='5'>
        
          <tr valign='top'>
            <td class='attr-rw'>
              [RW]
            </td>
            <td class='attr-name'>output_buffer</td>
            <td class='attr-desc'></td>
          </tr>
        
          <tr valign='top'>
            <td class='attr-rw'>
              [RW]
            </td>
            <td class='attr-name'>view_flow</td>
            <td class='attr-desc'></td>
          </tr>
        
      </table>
    


    <!-- Methods -->
        
      <div class="sectiontitle">Instance Public methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-i-_layout_for">
            
              <b>_layout_for</b>(name=nil)
            
            <a href="Context.html#method-i-_layout_for" name="method-i-_layout_for" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Encapsulates the interaction with the view flow so it returns the correct
buffer on <code>yield</code>. This is usually overwritten by helpers to add
more behavior. :api: plugin</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-_layout_for_source')" id="l_method-i-_layout_for_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/201156b6a9f090c21953e2c69a41f28c33545a1f/actionpack/lib/action_view/context.rb#L31" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-_layout_for_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_view/context.rb, line 31</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">_layout_for</span>(<span class="ruby-identifier">name</span>=<span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">name</span> <span class="ruby-operator">||=</span> <span class="ruby-value">:layout</span>
  <span class="ruby-identifier">view_flow</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">name</span>).<span class="ruby-identifier">html_safe</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-_prepare_context">
            
              <b>_prepare_context</b>()
            
            <a href="Context.html#method-i-_prepare_context" name="method-i-_prepare_context" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Prepares the context by setting the appropriate instance variables. :api:
plugin</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-_prepare_context_source')" id="l_method-i-_prepare_context_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/201156b6a9f090c21953e2c69a41f28c33545a1f/actionpack/lib/action_view/context.rb#L21" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-_prepare_context_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_view/context.rb, line 21</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">_prepare_context</span>
  <span class="ruby-ivar">@view_flow</span>     = <span class="ruby-constant">OutputFlow</span>.<span class="ruby-identifier">new</span>
  <span class="ruby-ivar">@output_buffer</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-ivar">@virtual_path</span>  = <span class="ruby-keyword">nil</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                    </div>

    </div>
  </body>
</html>    